Companion

object Companion

Properties

Link copied to clipboard
const val BRACKET_HIGH: Double = 1.0E10
Link copied to clipboard
const val BRACKET_LOW: Double
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
const val EPSILON: Double = 1.0E-12
Link copied to clipboard
Link copied to clipboard
const val MAX_CASHFLOW_PRECISION: Double = 1.0E-5
Link copied to clipboard
const val MAX_ITER: Int = 100
Link copied to clipboard
Link copied to clipboard
const val NPV_SCALE_FACTOR: Double = 1.0E-14
Link copied to clipboard
const val TOLERANCE: Double = 1.0E-8

Functions

Link copied to clipboard

Performs a deep clone of the supplied list of cash flows. All entries in the list will be new / cloned cash flow entries. The returned list will be in the same order as the supplied list of cash flows.

fun cloneCashFlows(cashFlows: List<ROICashFlowEntry>, toCurr: CurrencyType, toDate: Int? = null): List<ROICashFlowEntry>

Performs a deep clone of the supplied list of cash flows whilst also converting the currency and value(s). All entries in the list will be new / cloned cash flow entries. The returned list will be in the same order as the supplied list of cash flows.

Link copied to clipboard

Estimates an initial 'guess' seed percentage for use with computeIRR, using a centroid-weighted strategy. This method guards against flat or unhelpful seed values by applying minimum magnitude and clamping thresholds, improving convergence of the Secant method.

Link copied to clipboard

obtain a list of problem solving strategies (in the correct order) that can approximate xirr() formulas

Link copied to clipboard
fun hasValidCashFlows(cashFlows: List<ROICashFlowEntry>?, allowAllZerosCashFlows: Boolean): Boolean

Validates the list of cash flows to ensure it meets ROI/IRR requirements:

Link copied to clipboard
fun recomputeStartDate(cashFlows: List<ROICashFlowEntry>?, currentBeginDate: Int): Int

Recomputes the start date for a list of cash flows. The start date affects the result of an IRR computation the most, since every cash flow is computed against the start date. There are times when you should recompute the start date because it has been initially estimated, for example when the user picks 'All Dates' in a report and the start date defaults to 1970. This (for example) would make the IRR computation artificially low.

Link copied to clipboard
fun sanitizeIRR(rawIRR: Double?, maxIRR: Double? = MAX_SENSIBLE_IRR): Double

Validates and sanitizes a pre-calculated IRR value.

Link copied to clipboard
fun setCashFlowsStartDate(cashFlows: List<ROICashFlowEntry>?, startDateInt: Int)

Define the start date for a series of cash flows, and thus compute/recompute the number of years to the end. This function calls ROICashFlowEntry.setStartDate on each cash flow entry.